package com.mqtt.controller;

import com.mqtt.mqtt.MyGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 咕唧
 * @Date 2022/7/30 16:52
 * @Version 1.0
 */
@RestController
public class MqttController {
    private MyGateway myGateway;

    @Autowired
    public void setMyGateway(MyGateway myGateway) {
        this.myGateway = myGateway;
    }

    @PostMapping("/msg")
    public String sendMsg(String msg) {
        myGateway.sendToMqtt(msg);
        return "success";
    }
}
